﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLK.Database.DALs;

namespace QLK.Database.BLLs
{
    public class Storage_ProductBLL
    {
        private Storage_ProductDAL dal;

        public Storage_ProductBLL()
        {
            dal = new Storage_ProductDAL();
        }

        public List<Storage_Product> Storage_ProductGetAll()
        {
            return dal.Storage_ProductGetAll();
        }

        public Storage_Product Storage_ProductGetByID(int StorageID, int ProductID)
        {
            if (StorageID > 0 && ProductID > 0)
                return dal.Storage_ProductGetByID(StorageID, ProductID);

            return null;            
        }

        public bool Storage_ProductInsert(Storage_Product sps)
        {
            if (dal.Storage_ProductCheckDuplicateProduct(sps.StorageID, sps.ProductID))
                return false;
            return dal.Storage_ProductInsert(sps);
        }

        public bool Storage_ProductUpdate(Storage_Product sps)
        {
            if (dal.Storage_ProductCheckDuplicateProduct(sps.StorageID, sps.ProductID))
                return false;
            return dal.Storage_ProductUpdate(sps);
        }

        public bool Storage_ProductDelete(int StorageID, int ProductID)
        {
            return dal.Storage_ProductDelete(StorageID, ProductID);
        }
    }
}
